import SocketIO from 'socket.io-client';

export default class SocketIoConnection {

  constructor(config) {
    super();
    this.connection = new SocketIO(config.url, config.socketio);
  }

  on(ev, fn) {
    this.connection.on(ev, fn);
  }

  emit() {
    this.connection.emit.apply(this.connection, arguments);
  }

  getSessionid() {
    return this.connection.id;
  }

  disconnect() {
    return this.connection.disconnect();
  }
}
